#ifndef __COUNTER_H
#define __COUNTER_H

#include "fsl_common.h"


#define GPT_IRQ_ID             GPT2_IRQn
#define EXAMPLE_GPT            GPT2
#define EXAMPLE_GPT_IRQHandler GPT2_IRQHandler


void counterInit(void);


static inline void counterStart(void)
{
    EXAMPLE_GPT->CR |= GPT_CR_EN_MASK;
}

static inline void counterStop(void)
{
    EXAMPLE_GPT->CR &= ~GPT_CR_EN_MASK;
}

static inline uint32_t counterGetValue(void)
{
    return EXAMPLE_GPT->CNT;
}
#endif

